<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class DutiesAccept extends Model
{
    public $timestamps = false;
    protected $connection = 'xz';
    protected $table = 'duties_accept';
    use HasFactory;

    
    public function user()
    {
        return $this->hasOne('App\Models\Personal','id','uid')->with('department')->select('id','name','tell','department_id');
    }

    public function studys()
    {
        return $this->hasMany('App\Models\StudyLog','uid','uid')->select('id','course_id','uid','video_id','task_id');
    }

    public function papers()
    {
        return $this->hasMany('App\Models\DutiesTestPaper','task_id','task_id')->select('id','exam_time','course_id','task_id');
    }

    public function answers()
    {
        return $this->hasMany('App\Models\AnswerSheet','uid','uid')->select('id','tid','complete','uid');
    }
    
}
